<!--#include file="lib/utf-8.asp"-->
<!--#include file="lib/connopen.asp"-->
<!--#include file="lib/asp-common-lib.asp"-->
<%
tx_search=trim(SafeRequest("tx_search",0))
itype=trim(SafeRequest("itype",0))
bmiss=trim(SafeRequest("bmiss",0))
bhdmi=trim(SafeRequest("bhdmi",0))
ioperate=trim(SafeRequest("ioperate",0))
srefer=trim(SafeRequest("srefer",0))
soldsoftver=trim(SafeRequest("soldsoftver",0))
snewsoftver=trim(SafeRequest("snewsoftver",0))
semsver=trim(SafeRequest("semsver",0))
ksrq=trim(SafeRequest("ksrq",0))
' if ksrq<>"" then ksrq=cdate(ksrq)
jsrq=trim(SafeRequest("jsrq",0))
' if jsrq<>"" then jsrq=cdate(jsrq)
search_count=trim(SafeRequest("search_count",1))
'组合sql查询字符串
'sql="select * from cdfee where true "
sql="select "
sql=sql&" * from faultrecord where 1 "

if tx_search<>"" then
    sql=sql&" and (ndip like '%"&tx_search&"%' or sContent like '%"&tx_search&"%' or sMemo like '%"&tx_search&"%' or sCpeMac like '%"&tx_search&"%')"
end if
if ksrq<>"" and jsrq<>"" then sql=sql&" and (date(dtDate)>='"&ksrq&"' and date(dtDate)<='"&jsrq&"')"
if itype<>"" then sql=sql&" and iType="&itype
if bmiss<>"" then sql=sql&" and bMiss="&bmiss
if bhdmi<>"" then sql=sql&" and bHdmi="&bhdmi
if ioperate<>"" then sql=sql&" and iOperate="&ioperate
if srefer<>"" then sql=sql&" and sRefer='"&srefer&"'"
if soldsoftver<>"" then sql=sql&" and sOldSoftVer='"&soldsoftver&"'"
if snewsoftver<>"" then sql=sql&" and sNewSoftVer='"&snewsoftver&"'"
sql=sql&" order by dtDate desc,dtLog desc"
if search_count<>0 then sql=sql&" limit "&search_count

' response.write sql
' response.end
'执行数据查询
set rs = Server.CreateObject("ADODB.Recordset")
rs.cursorlocation=3
rs.open sql,conn,1,1
If rs.eof Then
  response.write("没有检索到数据!")
  response.end
End if

'分页控制
If saferequest("page",0)<>"" Then page=clng(saferequest("page",0)) Else page=1
pc=saferequest("pc",1)
If pc="" Then pc=25
rs.pagesize=pc
pagesize=rs.pagesize
pagecount=rs.pagecount
'page=clng(request.QueryString("page"))
if Not IsEmpty(page) then '如果page_num已经初始化...
  if Not IsNumeric(page) then '判断page_num值是否为数字
    page=1
  else
    page = clng(page) '接收page_num并化为数字型赋给page_num变量
  end if
  if page > pagecount then '如果接收的页数大于总页数
    rs.AbsolutePage = pagecount '设置当前显示页等于最后页
  elseif page <= 0 then '如果page小于等于0
    page=1
    rs.AbsolutePage = page '设置当前显示页等于第一页
  else
    rs.AbsolutePage = page '如果大于零,显示当前页等于接收的页数
  end if
  page = rs.AbsolutePage
end if
%>

<table id="tb_poll" class="full">
  <thead>
    <tr>
      <th></th>
      <th>IP Address</th>
      <th>Date</th>
      <th>Content</th>
      <th>Type</th>
      <th>Operate</th>
      <th>Miss</th>
      <th>Hdmi</th>
      <th>CpeMac</th>
      <th>OldSoftVer</th>
      <th>NewSoftVer</th>
      <th>EmsVer</th>
      <th>Refer</th>
      <th>Memo</th>
    </tr>
  </thead>
  <tbody>
  <%
  For i=1 To pagesize
    If rs.eof Then Exit for
  %>
    <tr>
      <td><a target="_blank" href="faultrecord.asp?id=<%=rs("id")%>"><%=rs.AbsolutePosition%></a></td>
      <td><a class="res" href="#" rel="ndinfo.asp?ndip=<%=rs("ndip")%>"><%=rs("ndip")%></a></td>
      <td><%=rs("dtDate")%></td>
      <td><%=rs("sContent")%></td>
      <td><%
            if rs("iType")=1 then response.write("ND")
            if rs("iType")=2 then response.write("网管")
          %></td>
      <td><%
            if rs("iOperate")=1 then response.write("Reboot")
            if rs("iOperate")=2 then response.write("Update")
            if rs("iOperate")=3 then response.write("Fix")
            if rs("iOperate")=4 then response.write("Delete")
            if rs("iOperate")=5 then response.write("Record")
          %></td>
      <td><%=rs("bMiss")%></td>
      <td><%=rs("bHdmi")%></td>
      <td><%=rs("sCpeMac")%></td>
      <td><%=rs("sOldSoftVer")%></td>
      <td><%=rs("sNewSoftVer")%></td>
      <td><%=rs("sEmsVer")%></td>
      <td><%=rs("sRefer")%></td>
      <td><%=rs("sMemo")%></td>
    </tr>
  <%
    rs.movenext
  next
  %>
  </tbody>
</table>
<div>
  <span id="pagebar">
    共查询到&nbsp;<%=rs.RecordCount%>&nbsp;条记录&nbsp;
    <%If page>1 Then%>
      [<a href="#" id="1">首页</a>]
      [<a href="#" id="<%=page-1%>">上一页</a>]
    <%
        End If
        If Not (page>=pagecount Or pagecount=0) Then
    %>
      [<a href="#" id="<%=page+1%>">下一页</a>]
      [<a href="#" id="<%=pagecount%>">尾页</a>]
    <%End If %>
      第 <%=page%> 页 / 共 <%=pagecount%> 页
      转到<input id="page_val" type="text" size="2" maxlength="<%=Int(Log(pagecount))+1%>" value="<%=page%>" />页
      <input id="page_go" class="bt_button" type="button" value="Go" />
  </span>
</div>
<%
rs.close
Set rs=nothing
%>
<!--#include file="lib/connclose.asp"-->

